package Algorithm.DoublePointer;
//https://leetcode-cn.com/problems/container-with-most-water/
public class Leetcode11 {
    class Solution {
        public int maxArea(int[] height) {
            int left = 0;
            int right = height.length-1;

            int max = -1;
            while(left<right){
                int temp = (right-left)*Math.min(height[left], height[right]);

                if(temp>max){
                    max = temp;
                }

                if(height[left]<height[right]){
                    left++;
                }else{
                    right--;
                }
            }

            return max;
        }
    }
}
